﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OBDUDSUtils.Common
{
    class DataConvert
    {
        public static string Reverse2Byte(string input)
        {
            return input.Substring(2, 2) + input.Substring(0, 2);
        }

        public static string Reverse4Byte(string input)//0a0b0c0d
        {
            return input.Substring(4, 4) + input.Substring(0, 4);
        }

        public static byte[] StringConvert2Byte(string inputStr)
        {
            var strArray = inputStr.Split(' ');
            byte[] buffer = new byte[strArray.Length];
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] = Convert.ToByte(strArray[i], 16);
            }
            return buffer;
        }
    }
}
